01 / 06

What are different ways a Lambda function is invoked?

AWS Lambda functions can be invoked in multiple ways depending on the use case. Lambda supports both synchronous and asynchronous invocation models, and can be triggered by various AWS services, APIs, or directly through the AWS SDK or CLI.

Synchronous Invocation
  1. 1

    API Gateway – invoke in real-time via HTTP endpoints

  2. 2

    Application Load Balancer – trigger with HTTP requests

  3. 3

    AWS SDK or AWS CLI – direct programmatic invocation

  4. 4

    Amazon Lex – as part of chatbot workflows

  5. 5

    Amazon CloudFront (via Lambda@Edge) – run code close to users

Asynchronous Invocation
  1. 1

    Amazon S3 – trigger on object uploads, deletions, etc.

  2. 2

    Amazon SNS – respond to published messages

  3. 3

    Amazon EventBridge – handle scheduled or rule-based events

  4. 4

    Amazon SES – trigger on email receipt events

Poll-Based Invocation
  1. 1

    Amazon SQS – poll messages from queues and process them

  2. 2

    Amazon Kinesis – consume real-time streaming data

  3. 3

    Amazon DynamoDB Streams – react to data modifications

Invoke Lambda Synchronously via AWS CLI
Difficulty: 5/10
Topics: Invocation sources, Sync vs async, Event-driven triggers

Scenario Questions

0-2 years experience
  1. 1

    You need to set up a Lambda that processes files uploaded to an S3 bucket. Walk me through how you would configure the invocation.

  2. 2

    If you want a Lambda to run every night at 2 AM, which invocation method would you choose and why?

  3. 3

    What happens if you invoke a Lambda directly via the AWS SDK versus through an API Gateway endpoint?

2-5 years experience
  1. 1

    Our service uses an S3 event to trigger a Lambda, but we’re seeing duplicate executions for the same object. How would you investigate the invocation source and prevent duplicates?

  2. 2

    We switched a Lambda from being invoked synchronously by API Gateway to being invoked asynchronously via SNS. What trade‑offs did we introduce regarding latency and error handling?

  3. 3

    During a recent deployment, a Lambda that was triggered by a DynamoDB stream stopped processing records. What could cause the invocation to fail and how would you debug it?

5-8 years experience
  1. 1

    Design a pattern for a high‑throughput data pipeline where a Lambda is invoked by Kinesis, but you need at‑least‑once processing guarantees and controlled concurrency. What invocation settings and downstream handling would you use?

  2. 2

    We have a mixed workload: some requests need sub‑second response via API Gateway, others are batch jobs triggered by EventBridge. How would you architect the Lambda functions and choose invocation modes to meet both latency and cost goals?

  3. 3

    Explain how you would implement a fallback mechanism if an asynchronous invocation (e.g., via SQS) repeatedly fails, ensuring no data loss.

8+ years experience
  1. 1

    Our organization is migrating legacy monolith services to a serverless architecture. How would you decide which existing endpoints should be moved to Lambda invoked via API Gateway versus EventBridge or SQS, considering operational ownership and scaling?

  2. 2

    We need to build a cross‑team event‑driven platform where dozens of services publish events that trigger Lambdas. What governance and invocation strategy would you put in place to avoid coupling, manage versioning, and ensure observability?

  3. 3

    Describe the long‑term cost and reliability implications of using synchronous API Gateway invocations versus asynchronous EventBridge for a globally distributed user base.

Follow-up Questions

  • Can you compare the latency characteristics of synchronous versus asynchronous invocations?
  • How does Lambda’s retry behavior differ across these invocation sources?
  • What monitoring metrics would you watch to detect invocation failures?